package likou.jindian;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2020/12/09 05:47
 */
public class _04_05 {
    TreeNode pre;

    //严格前一个左大于一个右
    //中序遍历
    public boolean isValidBST(TreeNode root) {
        if (root == null) return true;
        Boolean L = isValidBST(root.left);
        if (pre != null && pre.val >= root.val) return false;
        pre = root;
        Boolean R = isValidBST(root.right);
        return L && R;
    }
}
